import { Button, Modal, Form, Input, Radio } from 'antd';

const AddCategoryModal = Form.create({ name: 'form_in_modal' })(
  // eslint-disable-next-line
  class extends React.Component {
    render() {
      const { visible, onCancel, onCreate, form,label,val } = this.props;
      const { getFieldDecorator } = form;
      return (
        <Modal
          visible={visible}
          title={`新增${label}`}
          onCancel={onCancel}
          onOk={onCreate}
          okText='确定'
          cannelText="取消"
        >
          <Form layout="vertical">
            <Form.Item label={`${label}名称`}>
              {getFieldDecorator('title', {
                rules: [{ required: true, message: `请填写${label}名称` }],
                initialValue:val
              })(<Input onPressEnter={onCreate} maxLength={100} />)}
            </Form.Item>
          </Form>
        </Modal>
      );
    }
  },
);

export  default AddCategoryModal;
